package com.liuli.springcloud.controller;

import com.liuli.springcloud.pojo.Dept;
import com.liuli.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * Created by Admin on 2019/12/13.
 */
@RestController
public class DeptConsumerController {

    @Autowired
    DeptClientService deptClientService;

    //根据ID返回用户信息
    @RequestMapping("/consumer/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id){

        return this.deptClientService.queryById(id);
    }

    //返回所有用户信息
    @RequestMapping("/consumer/dept/list")
    public List<Dept> list(){

        return this.deptClientService.queryAll();
    }

    //增加用户
    @RequestMapping("/consumer/dept/add")
    public boolean add(Dept dept){
        return this.deptClientService.addDept(dept);
    }



}
